package HomeWork.Protot;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

// 定义简单的动态代理类
public class SimpleProxyHandler implements InvocationHandler {
    private Object target;

    public SimpleProxyHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("方法执行之前");
        Object result = method.invoke(target, args);
        System.out.println("方法执行之后");
        return result;
    }
}